import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'DefaultLayout',
    component: () => import('@/layouts/DefaultLayout.vue'),
    children: [
      {
        path: '',
        name: 'Home',
        component: () => import('@/views/HomeView.vue'),
      },
      {
        path: '/music/:id',
        name: 'MusicDetail',
        component: () => import('@/views/MusicDetailView.vue'),
      },
      {
        path: '/album/:id',
        name: 'AlbumDetail',
        component: () => import('@/views/AlbumDetailView.vue'),
      },
      {
        path: '/search',
        name: 'Search',
        component: () => import('@/views/SearchView.vue'),
      },
      {
        path: '/profile',
        name: 'Profile',
        component: () => import('@/views/ProfileView.vue'),
      },
      {
        path: '/profile/:id',
        name: 'ProfileDetail',
        component: () => import('@/views/ProfileView.vue'),
      },
      {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/LoginView.vue'),
      },
      {
        path: '/register',
        name: 'Register',
        component: () => import('@/views/RegisterView.vue'),
      },
      {
        path: '/upload',
        name: 'Upload',
        component: () => import('@/views/UploadMusicView.vue'),
      },
      {
        path: '/upload-album',
        name: 'UploadAlbum',
        component: () => import('@/views/UploadAlbumView.vue'),
      },
      {
        path: '/all-music',
        name: 'AllMusic',
        component: () => import('@/views/AllMusicView.vue'),
      },
    ],
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router
